package com.demoworld;

import org.apache.hadoop.hbase.client.Result;

import java.util.Map;
import java.util.NavigableMap;
import java.util.UUID;

/**
 * Hello world!
 */
public class Startup {
    private static final String TABLENAME = "francis-table-20180924-01";
    private static final String FAMILYNAME = "family01";

    public static void main(String[] args) throws Exception {
        Result result = HbaseDao.getResult(TABLENAME, "rk0");
        NavigableMap<byte[], byte[]> res = result.getFamilyMap(FAMILYNAME.getBytes());
        for (Map.Entry<byte[], byte[]> item : res.entrySet()) {
            System.out.println(new String(item.getKey()) + ", " + new String(item.getValue()));
        }
    }

    public static void put() throws Exception {
        String uuid = "";
        int i = 0;
        while (true) {
            uuid = UUID.randomUUID().toString();
            HbaseDao.put(TABLENAME, "rk" + i, FAMILYNAME, uuid, uuid);
            HbaseDao.put(TABLENAME, "rk" + i, FAMILYNAME, uuid + "-1", uuid + "-1");
            i++;
            System.out.println("ok");
        }
    }
}
